package com.cowealth.platform.common.base.constant;


import com.cowealth.platform.common.base.vo.result.ReturnCode;

/**
 * 全局返回编码枚举
 *
 * @author : skycdm
 * @version : 1.0.0
 * @date : 2021/2/25 15:53
 */
public interface GlobalReturnCodeConstants {

    // ========== 客户端错误段 Begin==========

    ReturnCode SUCCESS = new ReturnCode(200, "成功");



    // ========== 客户端错误段 Begin==========

    ReturnCode BAD_REQUEST = new ReturnCode(400, "请求参数不正确");
    ReturnCode UNAUTHORIZED = new ReturnCode(401, "账号未登录");
    ReturnCode FORBIDDEN = new ReturnCode(403, "没有该操作权限");
    ReturnCode NOT_FOUND = new ReturnCode(404, "请求未找到");
    ReturnCode METHOD_NOT_ALLOWED = new ReturnCode(405, "请求方法不正确");



    // ========== 服务端错误段 Begin==========

    ReturnCode INTERNAL_SERVER_ERROR = new ReturnCode(500, "系统异常");
    ReturnCode UNKNOWN = new ReturnCode(999, "未知错误");


    static boolean isMatch(Integer code) {
        return code != null
                && code >= SUCCESS.getCode() && code <= UNKNOWN.getCode();
    }
}
